package org.example.utils;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

@Getter
@Setter
@NoArgsConstructor
public class ResultTemplate<T> implements Serializable {
    public boolean success;
    public Integer code;
    public String message;
    public T data;

    /**
     * 不带数据响应
     * @param authCode
     */
    public ResultTemplate(AuthCode authCode){
        success = authCode.success;
        code = authCode.code;
        message = authCode.message;
    }

    /**
     * 带数据响应
     * @param authCode
     */
    public ResultTemplate(AuthCode authCode, T data){
        success = authCode.success;
        code = authCode.code;
        message = authCode.message;
        this.data = data;
    }
}
